- name: make the app be real
  hosts: os-masters[0]:os-masters-stg[0]
  user: root
  gather_facts: False

  vars_files:
    - /srv/web/infra/ansible/vars/global.yml
    - "/srv/private/ansible/vars.yml"
    - /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml

  roles:
  - role: openshift/project
    app: bodhi
    description: bodhi
    appowners:
    - bowlofeggs
  - role: openshift/keytab
    app: bodhi
    key: koji-keytab
    secret_name: bodhi-keytab
    service: bodhi
    host: "bodhi{{ env_suffix }}.fedoraproject.org"
  - role: openshift/secret-file
    app: bodhi
    secret_name: bodhi-fedmsg-key
    key: fedmsg-bodhi.key
    privatefile: fedmsg-certs/keys/bodhi-bodhi01.stg.phx2.fedoraproject.org.key
    when: env == "staging"
  - role: openshift/secret-file
    app: bodhi
    secret_name: bodhi-fedmsg-key
    key: fedmsg-bodhi.key
    privatefile: fedmsg-certs/keys/bodhi-bodhi-web-temp-bodhi.app.os.fedoraproject.org.key
    when: env != "staging"
  - role: openshift/secret-file
    app: bodhi
    secret_name: bodhi-fedmsg-crt
    key: fedmsg-bodhi.crt
    privatefile: fedmsg-certs/keys/bodhi-bodhi01.stg.phx2.fedoraproject.org.crt
    when: env == "staging"
  - role: openshift/secret-file
    app: bodhi
    secret_name: bodhi-fedmsg-crt
    key: fedmsg-bodhi.crt
    privatefile: fedmsg-certs/keys/bodhi-bodhi-web-temp-bodhi.app.os.fedoraproject.org.crt
    when: env != "staging"
  - role: openshift/imagestream
    app: bodhi
    imagename: bodhi-web
  - role: openshift/object
    app: bodhi
    template: buildconfig.yml
    objectname: buildconfig.yml
    bodhi_version: 3.7.0-1.fc27
    when: env == "staging"
  - role: openshift/object
    app: bodhi
    template: buildconfig.yml
    objectname: buildconfig.yml
    bodhi_version: 3.7.0-1.fc27
    when: env != "staging"
  - role: openshift/start-build
    app: bodhi
    buildname: bodhi-web
  - role: openshift/object
    app: bodhi
    template_fullpath: "{{roles_path}}/bodhi2/base/templates/configmap.yml"
    objectname: configmap.yml
  - role: openshift/object
    app: bodhi
    file: service.yml
    objectname: service.yml
  - role: openshift/route
    app: bodhi
    routename: bodhi-web
    host: "bodhi{{ env_suffix }}.fedoraproject.org"
    serviceport: web
    servicename: bodhi-web
  - role: openshift/object
    app: bodhi
    file: deploymentconfig.yml
    objectname: deploymentconfig.yml
  - role: openshift/rollout
    app: bodhi
    dcname: bodhi-web
